package cn.y.operation.framework.exception;


import cn.y.operation.framework.enums.ResponseMsgEnum;

/**
 * 自定义异常(CustomException)
 */
@SuppressWarnings("serial")
public class BusinessException extends RuntimeException {
    private Integer errCode;

    private String errMsg;

    public BusinessException(String code) {
        super(code);
    }

    public BusinessException(ResponseMsgEnum em) {
        super(em.getCode().toString());
        this.errCode = em.getCode();
        this.errMsg = em.getInfo();
    }

    public BusinessException(Integer errCode, String errMsg) {
        super(errCode != null ? errCode.toString() : null);
        this.errCode = errCode;
        this.errMsg = errMsg;
    }

    public Integer getErrCode() {
        return errCode;
    }

    public void setErrCode(Integer errCode) {
        this.errCode = errCode;
    }

    public String getErrMsg() {
        return errMsg;
    }

    public void setErrMsg(String errMsg) {
        this.errMsg = errMsg;
    }
}
